16/05/23 PH
This notebook: results for orb12 (HOMO) bond-scan runs (ongoing).
For previous results (inc. AF) see: https://phockett.github.io/ePSdata/OCS-preliminary/OCS_orbs8-11_AFBLMs_VM-ADMs_140122-JAKE_tidy-replot-200722_v5.html
For methods: https://epsproc.readthedocs.io/en/dev/demos/ePSproc_class_demo_161020.html
!hostname
!conda env list
import sys
import os
from pathlib import Path
import numpy as np
# import epsproc as ep
import xarray as xr
import matplotlib.pyplot as plt
from datetime import datetime as dt
timeString = dt.now()
import epsproc as ep
# Plotters
from epsproc.plot import hvPlotters
# Multijob class dev code
from epsproc.classes.multiJob import ePSmultiJob
hvPlotters.setPlotters(width = 700, snsStyle='whitegrid')
# For class, above settings don't take, not sure why, something to do with namespaces/calling sequence?
# Overriding snsStyle does work however... although NOT CONSISTENTLY????
# AH, looks like ordering matters - set_style LAST (.set seems to override)
import seaborn as sns
sns.set(rc={'figure.figsize':(10,6)}) # Set figure size in inches
sns.set_context("paper")
sns.set_style("whitegrid") # Set plot style
sns.set_palette("Paired") # Set colour mapping
# Try direct fig type setting for PDF output figs
from IPython.display import set_matplotlib_formats
# set_matplotlib_formats('png', 'pdf')
set_matplotlib_formats('svg', 'pdf')
# xr.set_options(display_style='html')
import warnings
# warnings.filterwarnings('once') # Skip repeated numpy deprecation warnings in current build (xr15 env)
warnings.filterwarnings('ignore') # Skip repeated numpy deprecation warnings in current build (xr15 env)
# # Scan for subdirs, based on existing routine in getFiles()
# fileBase = Path('/home/paul/ePS/OCS/OCS_survey') # Data dir on Stimpy
fileBase = Path('/mnt/fockSSHFS/globalhome/eps/OCS/OCS_bondscan_test') # Fock data dir mounted on Jake
# TODO: fix orb label here, currently relies on (different) fixed format
data = ePSmultiJob(fileBase, verbose = 0)
data.scanFiles()
data.jobsSummary()
# Resort data by key
sortedData = dict(sorted(data.data.items()))
data.data = sortedData
# Fix labels for plots
for key in data.data.keys():
# Label with bond %age change
data.data[key]['jobNotes']['orbLabel'] = key.split('_')[-1].strip('bond').replace('-','',1)
# Set keys for orb
plotKeys = [k for k in data.data.keys() if k.startswith('orb12')]
Table below shows calcs for 'PC', which is %age change from equilibrium case. Note this shifts both bond lengths by this %age.
# Collect bond scan data from individual datasets...
# STATUS: OUTPUTTING TO PD REF TABLE OK, code messy.
diffDict = {}
IPDict = {}
IParray = []
for n,key in enumerate(plotKeys):
label = key
PC = key.split('_')[-1].strip('bond').replace('-','',1) # Use replace to strip only single '-' and keep -ve values
orb = key.split('_')[0].strip('orb')
atomTable = data.data[key]['XS'].molInfo['atomTable'] #.diff('atom') # Diff works, but not in correct order!
diffs = np.abs(atomTable.sel(atom=3,props='z') - atomTable.sel(props='z')[0:2])
diffs['bonds']=('atom',['CS','CO'])
IParray.append([orb, -data.data[key]['XS'].orbInfo['orbIP'][0], float(PC), *diffs.data])
import pandas as pd
IPtab = pd.DataFrame(IParray, columns=['orb','IP/eV','PC (% bond shift)','C-S/angs.','C-O/angs.'])
display(IPtab)
IPtab.plot(y='IP/eV',x='PC (% bond shift)')
Reference plot (Gamess) - total energy (H) vs. PC

These are from ePolyScat's getCro function, and are LF (unaligned ensemble) results. This provides a good, if general, overview.
# NEED TO SET AGAIN AFTER CLASS IMPORT!
import warnings
# warnings.filterwarnings('once') # Skip repeated numpy deprecation warnings in current build (xr15 env)
warnings.filterwarnings('ignore') # Skip repeated numpy deprecation warnings in current build (xr15 env)
# Comparitive plot over datasets (all symmetries only)
Etype = 'Eke' # Set for Eke or Ehv energy scale
pGauge = 'L'
# Erange=[0, 100] # Plot range (full range if not passed to function below)
# data.plotGetCroComp(pType='SIGMA', Etype = Etype, Erange = Erange, backend = 'hv')
data.plotGetCroComp(keys = plotKeys, pType='SIGMA', pGauge = pGauge, Etype = Etype)
# data.plotGetCroComp(keys = plotKeys, pGauge = pGauge, Etype = Etype, backend='hv')
# Comparative plot over datasets (all symmetries only)
data.plotGetCroComp(keys = plotKeys, pType='BETA', Etype=Etype)
Cf. reference plot - looks like a slightly extended structure matches the experimental data better for both low-E XS, and betas, for the X-state case, something on the order of ~15 - 20% longer bonds than equilibrium case.

# Betas vs. Gauge
data.plotGetCro(keys = plotKeys, pType='BETA', Etype=Etype)
# print(data.jobInfo['ePolyScat'][0])
# print('Run: ' + jobInfo['Starting'][0].split('at')[1])
import scooby
scooby.Report(additional=['epsproc', 'xarray', 'jupyter', 'holoviews'])
# Check current Git commit for local ePSproc version
!git -C {Path(ep.__file__).parent} branch
!git -C {Path(ep.__file__).parent} log --format="%H" -n 1
# Check current remote commits
!git ls-remote --heads https://github.com/phockett/ePSproc
16/05/23 PH
Updated for orb12 bond-scan runs (ongoing).
Either fix self.tidyJobs():
Path(job.hostDefn[job.host]['jobComplete'], job.genFile.stem).as_posix(), which is wrong.Or write a quick script:
Manual/dev fixes, see http://jake/jupyter/user/paul/doc/tree/ePS/OCS/epsman2023/epsman_Fock-Docker_file-sorting_OCS_190523.ipynb
orb12_bond--0.12 case, not sure why.10/05/23 PH
tidyJobs() functionality.07/01/22 PH
Versions
13/12/21 PH
STATUS: basics in place, need to trim code and fix a few things still.
Revisiting AF cases with (hopefully) better match to experimental alignment.
TODO:
FIXED:
09/06/21 PH
Quick look at initial ePS results for orb 11 (HOMO), 2.5eV step size.
TODO:
For methods: https://epsproc.readthedocs.io/en/dev/demos/ePSproc_class_demo_161020.html
break